package view.screen;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;

import view.base.ListScreen;
import base.ScreenActionListener;
import controller.Controller;

public final class ImageSelectionScreen extends ListScreen{

	public ImageSelectionScreen(ScreenActionListener controller, String[] names, Image[] images){
		super(controller, "Profile Image Selection", List.EXCLUSIVE, null);

		this.addCommand(new Command("Choose", Command.OK, 1));

		for(int i = 0; i< images.length; ++i)
			this.append(names[i],images[i]);

		this.setCommandListener(this);
	}

	public void commandAction(Command c, Displayable d) {
		switch (c.getCommandType()) {
		case Command.OK:
			controller.viewAction(Controller.SELECT_COMMAND, new Integer(this.getSelectedIndex()));
			break;
		default:
			super.commandAction(c, d);
			break;
		}

	}

}
